package com.th.apicenter.ry;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 荣耀广告数据表（含转化跟踪）
 * @TableName th_ry_data
 */
@TableName(value ="th_ry_data")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ThRyData implements Serializable {
    /**
     * 主键ID
     */
    @TableId
    private Long id;

    /**
     * 账户ID
     */
    private String accountId;

    /**
     * 操作系统：0=Android, 1=iOS
     */
    private String os;

    /**
     * 用户IP地址（投放系统观测值）
     */
    private String ip;

    /**
     * 匿名设备标识（OAID原始值）
     */
    private String oaid;

    /**
     * 广告请求标识（请求时生成）
     */
    private String requestId;

    /**
     * 广告主ID（荣耀侧），用于归因
     */
    private String advertiserId;

    /**
     * 追踪ID（转化事件归因必填）
     */
    private String trackId;

    /**
     * 创意标识（crid，用于创意分析）
     */
    private String creativeId;

    /**
     * 事件发生时间（毫秒时间戳）
     */
    private Long eventTime;

    /**
     * 用户浏览器标识（UserAgent）
     */
    private String userAgent;

    /**
     * 广告分组ID
     */
    private String groupId;

    /**
     * 广告计划ID
     */
    private String campaignId;

    /**
     * 自定义结果字段（业务扩展用途）
     */
    private String ryResultVal;

    /**
     * 记录创建时间
     */
    private Date createdAt;

    /**
     * 最后更新时间
     */
    private Date updatedAt;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        ThRyData other = (ThRyData) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getOs() == null ? other.getOs() == null : this.getOs().equals(other.getOs()))
            && (this.getIp() == null ? other.getIp() == null : this.getIp().equals(other.getIp()))
            && (this.getOaid() == null ? other.getOaid() == null : this.getOaid().equals(other.getOaid()))
            && (this.getRequestId() == null ? other.getRequestId() == null : this.getRequestId().equals(other.getRequestId()))
            && (this.getAdvertiserId() == null ? other.getAdvertiserId() == null : this.getAdvertiserId().equals(other.getAdvertiserId()))
            && (this.getTrackId() == null ? other.getTrackId() == null : this.getTrackId().equals(other.getTrackId()))
            && (this.getCreativeId() == null ? other.getCreativeId() == null : this.getCreativeId().equals(other.getCreativeId()))
            && (this.getEventTime() == null ? other.getEventTime() == null : this.getEventTime().equals(other.getEventTime()))
            && (this.getUserAgent() == null ? other.getUserAgent() == null : this.getUserAgent().equals(other.getUserAgent()))
            && (this.getGroupId() == null ? other.getGroupId() == null : this.getGroupId().equals(other.getGroupId()))
            && (this.getCampaignId() == null ? other.getCampaignId() == null : this.getCampaignId().equals(other.getCampaignId()))
            && (this.getRyResultVal() == null ? other.getRyResultVal() == null : this.getRyResultVal().equals(other.getRyResultVal()))
            && (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()))
            && (this.getUpdatedAt() == null ? other.getUpdatedAt() == null : this.getUpdatedAt().equals(other.getUpdatedAt()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getOs() == null) ? 0 : getOs().hashCode());
        result = prime * result + ((getIp() == null) ? 0 : getIp().hashCode());
        result = prime * result + ((getOaid() == null) ? 0 : getOaid().hashCode());
        result = prime * result + ((getRequestId() == null) ? 0 : getRequestId().hashCode());
        result = prime * result + ((getAdvertiserId() == null) ? 0 : getAdvertiserId().hashCode());
        result = prime * result + ((getTrackId() == null) ? 0 : getTrackId().hashCode());
        result = prime * result + ((getCreativeId() == null) ? 0 : getCreativeId().hashCode());
        result = prime * result + ((getEventTime() == null) ? 0 : getEventTime().hashCode());
        result = prime * result + ((getUserAgent() == null) ? 0 : getUserAgent().hashCode());
        result = prime * result + ((getGroupId() == null) ? 0 : getGroupId().hashCode());
        result = prime * result + ((getCampaignId() == null) ? 0 : getCampaignId().hashCode());
        result = prime * result + ((getRyResultVal() == null) ? 0 : getRyResultVal().hashCode());
        result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
        result = prime * result + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", os=").append(os);
        sb.append(", ip=").append(ip);
        sb.append(", oaid=").append(oaid);
        sb.append(", requestId=").append(requestId);
        sb.append(", advertiserId=").append(advertiserId);
        sb.append(", trackId=").append(trackId);
        sb.append(", creativeId=").append(creativeId);
        sb.append(", eventTime=").append(eventTime);
        sb.append(", userAgent=").append(userAgent);
        sb.append(", groupId=").append(groupId);
        sb.append(", campaignId=").append(campaignId);
        sb.append(", ryResultVal=").append(ryResultVal);
        sb.append(", createdAt=").append(createdAt);
        sb.append(", updatedAt=").append(updatedAt);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}